package com.example.api.gateway.filter;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;

public class PostFilter extends ZuulFilter{

	@Override
	public Object run() {
		System.out.println("post Filter");
		HttpServletResponse httpServletResponse = RequestContext.getCurrentContext().getResponse();
		try {
			httpServletResponse.getOutputStream().print("hahahhahah");
			httpServletResponse.flushBuffer();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public boolean shouldFilter() {
		return true;
	}

	@Override
	public int filterOrder() {
		return 2000;
	}

	@Override
	public String filterType() {
		return "post";
	}

}
